//
// Created by 25313 on 2025/8/4.
//
#include <vector>
class Solution {
public:
    string convertToBase7(int num) {
        if(num == 0){
            return "0";
        }

        string res;
        if(num > 0){
            while(num >= 1){
                int x = num % 7;
                res += to_string(x);
                num = num / 7;
            }
            reverse(res.begin(),res.end());
            return res;
        }else{
            num = num * -1;
            while(num >= 1){
                int x = num % 7;
                res += to_string(x);
                num = num / 7;
            }
            res += '-';
            reverse(res.begin(),res.end());
            return res;
        }
    }
};